package com.itlong.cloud.operate.resource;

import com.itlong.cloud.POJO.DTO.operate.OperateActivitiesGetPageDTO;
import com.itlong.cloud.POJO.DTO.operate.OperateActivitiesSaveDTO;
import com.itlong.cloud.POJO.VO.operate.OperateActivitiesGetPageVO;
import com.itlong.cloud.operate.service.IOperateActivitiesService;
import com.itlong.cloud.project.operate.IOperateActivitiesServiceClient;
import com.itlong.cloud.utils.page.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <desc>
 *      运营-APP-启动页管理
 * </desc>
 *
 * @createDate 2019/06/24
 */
@RestController
public class OperateActivitiesServiceResource implements IOperateActivitiesServiceClient {
    @Autowired
    IOperateActivitiesService iOperateActivitiesService;

    /**
     * <desc>
     *      获取分页数据
     * </desc>
     *
     * @param dto 入参
     * @return page模型
     * @author Qiang.S
     * @createDate 2019/06/24
     */
    @RequestMapping(path = "/operate/marketer/activities/getActivitiesPage")
    @Override
    public Page<OperateActivitiesGetPageVO> getActivitiesPage(@RequestBody OperateActivitiesGetPageDTO dto) throws Exception {
        return iOperateActivitiesService.getActivitiesPage(dto);
    }

    /**
     * <desc>
     *      添加启动页
     * </desc>
     *
     * @param dto 功能实体
     * @return sql执行行数
     * @author Qiang.S
     * @createDate 2019/06/24
     */
    @Override
    @RequestMapping(path = "/operate/marketer/activities/save")
    public Integer save(@RequestBody OperateActivitiesSaveDTO dto) throws Exception {
        return iOperateActivitiesService.save(dto);
    }

    /**
     * <desc>
     *      修改功能
     * </desc>
     *
     * @param dto 功能实体
     * @return sql执行行数
     * @author Qiang.S
     * @createDate 2019/06/24
     */
    @Override
    @RequestMapping(path = "/operate/marketer/activities/update")
    public Integer update(@RequestBody OperateActivitiesSaveDTO dto) throws Exception {
        return iOperateActivitiesService.update(dto);
    }

    /**
     * <desc>
     *      查询单条功能
     * </desc>
     *
     * @param activitiesId 活动编号
     * @return 资源实体
     * @author Qiang.S
     * @createDate 2019/06/24
     */
    @Override
    @RequestMapping(path = "/operate/marketer/activities/getOne")
    public OperateActivitiesGetPageVO getOne(@RequestParam("activitiesId") String activitiesId) {
        return iOperateActivitiesService.getOne(activitiesId);
    }

    /**
     * <desc>
     *      删除功能
     * </desc>
     *
     * @param activitiesIds 活动编号,逗号分隔
     * @return 执行行数
     * @author Qiang.S
     * @createDate 2019/06/24
     */
    @Override
    @RequestMapping(path = "/operate/marketer/activities/delete")
    public Integer delete(@RequestParam("activitiesIds") String activitiesIds) {
        return iOperateActivitiesService.delete(activitiesIds);
    }

    /**
     * <desc>
     *      获取运营活动可用数据
     * </desc>
     *
     * @param projectId 项目编号
     * @return page模型
     * @author Qiang.S
     * @createDate 2019/06/24
     */
    @Override
    @RequestMapping(path = "/operate/marketer/activities/OperationalAdvertising")
    public List<OperateActivitiesGetPageVO> OperationalAdvertising(@RequestParam("projectId") String projectId) {
        return iOperateActivitiesService.OperationalAdvertising(projectId);
    }
}
